package com.hopes.bizz.poll.job;

import com.hopes.bizz.poll.pollaqi.service.PollAqiDataService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: ljh
 * @create: 2023/6/1
 */
@Service
@Slf4j
public class CalculateAQIMinService {

    @Autowired
    private PollAqiDataService pollAqiDataService;


    @XxlJob("calculateAQIMinHandler")
    public void calculateAQIMinHandler() {
        long start = System.currentTimeMillis();
        log.info("----------------计算分钟AQI----------------`");
        Boolean result = pollAqiDataService.calculateAQIMinHandler();
        log.info("----------------计算分钟AQI结束,结果为={},耗时(毫秒)={}----------------`", result, System.currentTimeMillis() - start);
        // 设置任务结果
        XxlJobHelper.handleSuccess();
    }
}
